﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Drawing;
using HtmlAgilityPack;
using System.Net;
using Taurus.Parking.DTO;
using Taurus.Platform.BLL;

namespace Taurus.Parking.BLL
{
    /// <summary>
    /// 汽车图片管理类
    /// </summary>
    class CarImage
    {
        private ImageManager _im = new ImageManager( @"E:\config\image\");

        public Image GetImage(Car car)
        {

            Image a = _im.GetImage(car.Pic);
            if (a == null)
            {
                //没有汽车图片是采用的默认图片
                try
                {
                    a = _im.DownImage(car.PicFullPath);
                }
                catch (Exception)
                {
                    a = global::Taurus.Parking.Properties.Resources.car;
                }
            }

            return a;
        }

        public void UpateCarImage(Car car, bool isCompulsory)
        {
            _im.DownImage(car.PicFullPath, string.Empty, isCompulsory);
        }
    }
}
